home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / intrvews / xgrab.lha / xgrab / include / token.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-03-07  |  3.0 KB  |  109 lines

  1. /**
  2.    GRAB Graph Layout and Browser System
  3.  
  4.    Copyright (c) 1989, Tera Computer Company
  5.  **/
  6.  
  7.   /* scanner header file */
  8.  
  9. #ifndef token_h
  10. #define token_h
  11.  
  12.   /* our extra-special character friends */
  13. #define special(c)    \
  14.     ((c) == '\n' || \
  15.      (c) == '=' || \
  16.      (c) == '.' || \
  17.      (c) == '(' || \
  18.      (c) == ')' || \
  19.      (c) == ';' || \
  20.      (c) == '\"')
  21.  
  22.   /* characters to ignore */
  23. #define whitespace(c)    \
  24.     ((c) == ' ' || \
  25.      (c) == '\t')
  26.  
  27.   /* indicators that a new token is anon */
  28. #define endchar(c)    \
  29.     (c == EOF || whitespace(c) || !isprint(c) || (c) == '\n')
  30.  
  31.   /* the tokens */
  32. typedef enum 
  33. {
  34.       /* scanner errors and eof */
  35.     EOF_TOKEN,             /* end of file */
  36.     ILLEGAL_CHAR_TOKEN,     /* non-white space, unprintable char */
  37.     ILLEGAL_START_TOKEN,    /* character that can't begin a string */
  38.       /* tokens with extra info */
  39.     STRING_TOKEN,        /* character string */
  40.     QSTRING_TOKEN,        /* quoted character string */
  41.       /* special characters */
  42.     NEWLINE_TOKEN,        /* newline */
  43.     EQUAL_TOKEN,         /* = */
  44.     PERIOD_TOKEN,         /* . */
  45.     OPENPAREN_TOKEN,         /* ( */
  46.     CLOSEPAREN_TOKEN,        /* ) */
  47.     SEMICOLON_TOKEN,        /* ; */
  48.       /* predicate evaluation (the usual crowd) */
  49.     AND_TOKEN,            /* 'and' */
  50.     OR_TOKEN,            /* 'or' */
  51.     NOT_TOKEN,            /* 'not' */
  52.     IF_TOKEN,            /* 'if' */
  53.     THEN_TOKEN,            /* 'then' */
  54.     ELSIF_TOKEN,        /* 'elsif' */
  55.     ELSE_TOKEN,            /* 'else' */
  56.     ENDIF_TOKEN,        /* 'endif' */
  57.       /* commands */
  58.     BREAK_TOKEN,        /* 'break' */
  59.     CONTINUE_TOKEN,        /* 'continue' */
  60.     SET_TOKEN,            /* 'set' */
  61.     COALESCE_TOKEN,        /* 'coalesce' */
  62.     EXPAND_TOKEN,        /* 'expand' */
  63.     HIDE_TOKEN,            /* 'hide' */
  64.     DISPLAY_TOKEN,        /* 'display' */
  65.     FOCUS_TOKEN,        /* 'focus' */
  66.       /* predefined variables and attributes */
  67.     SOURCE_TOKEN,        /* 'source' */
  68.     SINK_TOKEN,            /* 'sink' */
  69.     IN_TOKEN,            /* 'in' */
  70.     OUT_TOKEN,            /* 'out' */
  71.     PARENTS_TOKEN,        /* 'parents' */
  72.     CHILDREN_TOKEN,        /* 'children' */
  73.     ANCESTORS_TOKEN,        /* 'ancestors' */
  74.     DESCENDANTS_TOKEN,        /* 'descendants' */
  75.     SHAPE_TOKEN,        /* 'shape' */
  76.     BRUSH_TOKEN,        /* 'brush' */
  77.     COLOR_TOKEN,        /* 'color' */
  78.       /* predefined boolean attributes */
  79.     DISPLAYED_TOKEN,        /* 'displayed' */
  80.     NODE_TOKEN,            /* 'node' */
  81.     EDGE_TOKEN,            /* 'edge' */
  82.     COALESCER_TOKEN        /* 'coalescer' */
  83. } TOKEN;
  84.  
  85. #define FIRST_RESERVED_TOKEN     AND_TOKEN   
  86.             /* first reserved word in the token list.  Used for
  87.                converting from offsets in reserved_wd to values
  88.                of type TOKEN */
  89. #define FIRST_NREL_TOKEN    IN_TOKEN
  90.             /* similarly, first token used to denote relatives
  91.                of a node */
  92. #define FIRST_EREL_TOKEN    SOURCE_TOKEN
  93.             /* first token used to denote relatives of an edge */
  94.                         
  95. #define NUM_RESERVED     31    /* number of reserved words */
  96. #define NUM_NREL    6    /* number of tokens used to denote relatives 
  97.                    of a node */
  98. #define NUM_EREL    2    /* number of tokens used to denote relatives
  99.                    of an edge */
  100.  
  101. extern char *reserved_wd[NUM_RESERVED];
  102.  
  103. #define MAXBUFFER 1024
  104.  
  105. extern char char_val;
  106. extern char string_val[MAXBUFFER];
  107.  
  108. #endif
  109.